from datetime import datetime

YYYY_MM_DD_HH_MM_SS = "%Y-%m-%d %H:%M:%S"


def datetime_to_str(val: datetime = datetime.now(), pattern: str = YYYY_MM_DD_HH_MM_SS) -> str:
    """
    日期格式化
    :param val:
    :param pattern:
    :return:
    """
    return val.strftime(pattern)
